const PROD = "production";
let config;
// 生产环境加载生产配置，其他都加载开发配置
if (process.env.NODE_ENV === PROD) {
    config = require('./resources/application-prod');
} else {
    config = require('./resources/application-dev')
}

module.exports = {
    css: {
        // vue.config.js for less-loader@6.0.0
        loaderOptions: {
            less: {
                lessOptions: {
                    modifyVars: {
                        'primary-color': '#f1a402',
                        'link-color': '#f1a402',
                        'border-radius-base': '2px',
                        'box-shadow-base': '0 20px 27px rgba(0, 0, 0, 0.05)'
                    },
                    javascriptEnabled: true,
                },
            }
        },
    },
    productionSourceMap: true,
    configureWebpack: {
        externals: {
            "vue": "Vue",
            "vue-router": "VueRouter",
            "vuex": "Vuex",
            'moment': "moment",
            'ant-design-vue':'antd',
            'vue-json-pretty': 'VueJsonPretty'
        }
    },
    pages: {
        index: {
            entry: 'src/main.js',
            template: 'public/index.html',
            filename: 'index.html',
            chunks: ['chunk-vendors', 'chunk-common', 'index'],
            cdn: {
                css: config.css,
                js: config.js
            }
        }
    },
    devServer: {
        port: config.server.port
    }
};
